﻿using BBCore.Core.Models.BaseModels;
using System;
using FreeSql;
using FreeSql.DataAnnotations;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Core;
using FluentValidation;

namespace BBCore.Core.Models.Samples
{
    public class HYJ_Detail_Table:BaseModel,IDetailTable<int>
    {
        [ImporterHeader(IsIgnore = true)]
        [Column(IsIdentity = true)]
        public int ID { get; set; }

        [ImporterHeader(IsIgnore = true)]
        [Display(Name = "BODY_ID")]
        public int BODY_ID { get; set; }

        //Format ="@",设置默认格式为文本
        [ImporterHeader(Name = "部品号", Format = "@")]
        [Required(ErrorMessage = "部品号不可为空")]
        [Display(Name = "部品号")]
        public string? ITEM { get; set; }


        [ImporterHeader(Name = "LEVEL2")]
        public string? LEVEL2 { get; set; }
        [ImporterHeader(IsIgnore = true)]
        [Display(Name = "需要日期")]
        public DateTime REQ_DATE { get; set; } = DateTime.Now;

    }
    public class HYJ_Detail_Table_Validator : AbstractValidator<HYJ_Detail_Table>
    {
        public HYJ_Detail_Table_Validator()
        {
            RuleFor(x => x.ITEM).NotEmpty();
        }
    }
}
